﻿package mortal.game.view.guildNew.skill
{
    import Message.Public.*;
    import com.gengine.resource.*;
    import com.gengine.utils.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import extend.language.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.guildNew.data.*;
    import mortal.game.view.signUp.sevenDayLogin.item.*;
    import mortal.game.view.vip.panel.*;

    public class GuildNewSkillPanel extends GSprite implements GuildNewPanelI
    {
        protected var _bg:ScaleBitmap;
        protected var _donateBg:GBitmap;
        protected var _list:CellsGridSprite;
        protected var _line:ScaleBitmap;
        protected var _hornor:GBitmap;
        protected var _timeDes:GBitmap;
        protected var _honor:BitmapNumberText;
        protected var _canUpTime:BitmapNumberText;
        protected var _curSchoolLevel:GTextFiled;
        private var _hideTipArea:HideAreaSp;
        private var _vipTip:VipOpenTipsPanel;

        public function GuildNewSkillPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            LoaderHelp.addResCallBack(ResFileConst.guildNSkill, this.onReload);
            return;
        }// end function

        private function onReload() : void
        {
            this._bg = UIFactory.bg(0, 0, 748, 475, this, ImagesConst.PanelBg);
            this._donateBg = UIFactory.gBitmap(ImagesConst.GuildNewHornor, 11, 442, this);
            this._list = UIFactory.getUICompoment(CellsGridSprite);
            this._list.colNum = 5;
            this._list.vCellWid = 146;
            this._list.hCellWid = 216;
            this._list.genCellFun = UIFactory.getUICompoment;
            this._list.genCells(10, GuildNewSkillCell);
            this._list.x = 10;
            this._list.y = 4;
            this.addChild(this._list);
            this._line = UIFactory.bg(7, 439, 745, 1, this, ImagesConst.SplitLine);
            this._hornor = UIFactory.gBitmap(ImagesConst.honor, 161, 445, this);
            this._timeDes = UIFactory.gBitmap(ImagesConst.GuildNSkillUpTimesDes, 195, 448, this);
            this._honor = UIFactory.bitmapNumberText(94, 448, "WizardNum.png", 13, 17, -2, this, 13, 0);
            this._honor.text = "123";
            this._canUpTime = UIFactory.bitmapNumberText(348, 448, "WizardNum.png", 13, 17, -2, this, 13, 1);
            this._canUpTime.text = "20";
            this._curSchoolLevel = UIFactory.gTextField("", 591, 447, 250, 20, this, GlobalStyle.textFormatLv);
            this._hideTipArea = UIFactory.getUICompoment(HideAreaSp, 10, 441, this);
            this._hideTipArea.drawRec(150, 30, 0.01);
            this._hideTipArea.toolTipData = "" + Language.getString(71620);
            this._vipTip = UIFactory.getUICompoment(VipOpenTipsPanel, 380, 438, this);
            this._vipTip.valueType = VipOpenTipsPanel.numberValue;
            this._vipTip.resetLevelTextPos(45, 9, 62, 9);
            this._vipTip.resetValueTextPos(107, 9, 110, 9);
            this._vipTip.bgUrl = ImagesConst.vipOpenTipsBg_short;
            this._vipTip.isGray = true;
            this._vipTip.vipType = EVipRecordType._EVipRecordTypeGuildSkill;
            this.update();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            LoaderHelp.removeResEvent(ResFileConst.guildNSkill, this.onReload);
            this._bg = null;
            this._donateBg = null;
            this._list = null;
            this._line = null;
            this._hornor = null;
            this._timeDes = null;
            this._honor = null;
            this._canUpTime = null;
            this._curSchoolLevel = null;
            this._vipTip = null;
            this._hideTipArea = null;
            super.disposeImpl(param1);
            return;
        }// end function

        public function update() : void
        {
            this.updateSkills();
            this.updateBottom();
            return;
        }// end function

        private function updateSkills() : void
        {
            var _loc_3:String = null;
            var _loc_4:GuildNewSkillCell = null;
            var _loc_1:* = GuildNewUtil.indexToAttName;
            if (this._list == null || this._list.cellArr == null)
            {
                return;
            }
            var _loc_2:int = 0;
            while (_loc_2 < _loc_1.length && _loc_2 < this._list.cellArr.length)
            {
                
                _loc_3 = _loc_1[_loc_2];
                _loc_4 = this._list.cellArr[_loc_2];
                _loc_4.updateInfo(_loc_3, _loc_2);
                _loc_2++;
            }
            return;
        }// end function

        private function updateBottom() : void
        {
            if (this._honor == null)
            {
                return;
            }
            var _loc_1:* = GuildNewUtil.getSkillLearnArr();
            this._honor.text = "" + _loc_1[1];
            this._canUpTime.text = "" + _loc_1[2];
            var _loc_2:* = HTMLUtil.addColor(Language.getStringByParam(71621, _loc_1[0]), "#fad200");
            var _loc_3:* = Language.getString(71622) + _loc_2;
            this._curSchoolLevel.htmlText = HTMLUtil.addColor(_loc_3, "#00ff00");
            return;
        }// end function

    }
}
